home *** CD-ROM | disk | FTP | other *** search
/ Hacker's Arsenal - The Cutting Edge of Hacking / Hacker's Arsenal - The Cutting Edge of Hacking.iso / texts / cracking2.txt < prev    next >
Text File  |  2001-07-11  |  10KB  |  238 lines

  1. 
  2. Cracking Tutorial - Part 2    27/10/99
  3. 
  4.  
  5. Copyrights Reserved to the <TeCh~LoRd> 1999 from Black Sun Research Facility (http://blacksun.box.sk).
  6. 
  7. Index:
  8. 
  9. 0. Introduction.
  10. 1. Disclaimer.
  11. 2. The main steps of cracking.
  12. 3. Additional programs you need to have for this part of the tutorial.
  13. 4. Cracking the first program (sweet little piano).
  14. 5. Conclusion
  15. ========================================================================================
  16.  
  17.                                              
  18. 0. Introduction:
  19. 
  20.  
  21. In this part, the second part of the cracking tutorial, you will learn to use the most
  22. important tools of the common cracker: W32Dasm and HIEW.
  23. You will also learn to crack some simple programs.
  24.  
  25. The tutorials are divided into 3 parts:
  26.  
  27. Part 1: Introduction, tools and the basics of cracking.
  28. Part 2: Practical training, using W32Dasm, and HIEW.
  29. Part 3: key-generators.
  30.  
  31. Welcome to the second part.   :-)
  32.  
  33.  
  34. 
  35. 1. Disclaimer:
  36. 
  37.  
  38. I created this tutorial for informational purposes only!
  39. Much of the information in this document can be used to perform illegal activities!
  40. Don't attempt to do anything stated in this document!
  41. If you do attempt to do anything, you are solely and fully responsible for what you do!
  42. If you get caught and get in any kind of trouble, it's your own fault!
  43. If you intend to use this information to impress your friends, leave it and grow up!
  44. If you don't agree to this, do not read any more!
  45. If you crack a program, and either sell the crack or offer it for free, it is a crime!
  46.  
  47. 
  48. 2. The main steps of cracking
  49. 
  50.  
  51. You have already seen these steps in the previous part of the tutorial,
  52. but it's very important to know them. Remembering these steps and following them is 40%
  53. of the way towards success in cracking the program!!!
  54.  
  55. There are 7 steps in the cracking process:
  56.  
  57. 1. Run the program you want to crack and study it's behavior.
  58.    try to locate strings and keywords, try to enter the password and see how the program responds.
  59. 2. Open the program with the W32Dasm and disassemble it.
  60. 3. Find typical and common Strings in the disassembly that appeared within the program.
  61.    in most cases, you have to look for keywords such as: password, name, date, expired,
  62.    Time limit, wrong, entered and so on.
  63. 4. Find and observe the password generator, find the learn protection routine and the API calls.
  64. 5. Try to understand the jumping mechanism of the protection.
  65. 6. Open the program in Hiew.
  66.    change the jump of the flow control to it's opposite jump command, or NOP it out.
  67. 7. Run and check how the change you have made in the original program affected it.
  68.    Feel the power you have, the power of of cracking, making programs behave the way you want them to.
  69.  
  70. Learn those steps very well, until u dream of them, u will use them in every program you crack.
  71.  
  72. 
  73. 3. Additional programs you need to have for this part of the tutorial
  74. 
  75.  
  76. By now, in this part of the tutorial, you have learnt the main steps of cracking.
  77. Now, you are going to crack your first program.
  78.  
  79. But before that, you need to get a little program called: "Sweet Little Piano"
  80. You can download it from:
  81. -----------------
  82. www.ronimusic.com
  83. -----------------
  84.  
  85. Now, when you have the program, let's start!
  86.  
  87. 
  88. 4. Cracking the first program (Sweet little Piano)
  89. 
  90.  
  91. Now we will follow each step and crack the program:
  92.  
  93. ____________________________
  94. Step 1: Running the program:
  95. ____________________________
  96.  
  97. Well, Run it! Duh...    :-)
  98.  
  99. Well, what do we see here.....
  100. The program opens two text files.
  101. Also we see "Unregistered Shareware" on the caption bar...
  102. Now let's open the Help menu for any registration options...
  103. Humm, what do we see here now...
  104. oh, it's a password option... 
  105. Well, select it and enter something (don't hope it will be right :-)).
  106. To see what happens... Click OK..
  107. Hmm, nothing happens....
  108. Maybe it accepted it? Hmm.. no way... the caption bar still says Unregistered...
  109. Ok close it... bah ... more text files ... and a notification that the settings are not
  110. saved in the unregistered version ... well ... kind of irritating those text files!
  111. Let's fix it :-)
  112.  
  113. ________________________________
  114. Step 2: Disassemble the program:
  115. ________________________________
  116.  
  117. Disassemble the program. Good, small is fast :-) Always....
  118. Now, we don't have any strings that pop up when we want to register something...
  119. Let's browse for strings like registered, unregistered, the string about the unsaved settings.
  120. Hmm... evaluation time left ... password.txt.... passworddialog.... 
  121. sweet little piano - Unregistered <<-- looks like our caption bar ;-) go on...
  122. Thanks for registering ... cool! So it thanks you anyway :-)
  123. Let's jump to that place ... Double click on it an we will pop right on top of the registration routine...
  124.  
  125. _____________________________________________________________________________________
  126. Step 3: Analyzing the protection routine.... / Understanding the jumping Mechanism...
  127. _____________________________________________________________________________________
  128.  
  129. Let's analyze the protection routine.
  130.  
  131. ////////////////////// Code snip ///////////////////////////
  132. ADDRESS   MACHINE CODE        ASSEMBLER INSTRUCTIONS
  133.  
  134. * Possible Reference to Dialog: PASSWORDDIALOG, CONTROL_ID:0064, ""
  135.                                   |
  136. :00401715 6A64                    push 00000064
  137. :00401717 53                      push ebx
  138.  
  139. * Reference To: USER32.GetDlgItemTextA, Ord:0000h
  140.                                   |
  141. :00401718 E8A5B50000              Call 0040CCC2
  142. :0040171D E822FFFFFF              call 00401644
  143. :00401722 85C0                    test eax, eax
  144. :00401724 741E                    je 00401744
  145. :00401726 6A30                    push 00000030
  146.  
  147. * Possible StringData Ref from Data Obj ->"SweetPiano"
  148.                                   |
  149. :00401728 6866D24000              push 0040D266
  150.  
  151. * Possible StringData Ref from Data Obj ->"Thanks for registering!"
  152.                                   |
  153. :0040172D 68FED14000              push 0040D1FE
  154. :00401732 53                      push ebx
  155.  
  156. ////////////////////// Code snip ///////////////////////////
  157.  
  158. PasswordDialog ... a call to GetDlgItemTextA ... another call.... a test...
  159. and depending on the test a je.... The je jumps over the thank you ... 
  160. And just ends the dialog box ... without telling you that you entered something wrong...
  161. So this is right ... we did indeed not see that we typed something wrong ... but apparently we are supposed to see 
  162. if we type something right :-)
  163.  
  164. Again execute the je jump, and look where it goes to ... return from the jump....
  165. Now lets try to rewrite what goes on here...
  166.   
  167. ___________________________________________________________________________
  168.   call ShowPasswordDialog
  169.   call GetEnteredText
  170.   call IsEnteredTextGood
  171.   test value in eax
  172.   je   QuietExit
  173.  
  174.   ShowThanksForRegistering
  175.  
  176.   QuietExit:
  177. ___________________________________________________________________________
  178.  
  179. the source code must have looked like this :
  180. ___________________________________________________________________________
  181.   GetDlgItemText(_ID_Serial);
  182.   if (EnteredTextGood) ShowThanksForRegistering
  183.  
  184. // else nothing....
  185. ___________________________________________________________________________
  186.  
  187. This is another interesting piece of code.... test eax, eax ... this assembler instruction tests if the value of eax is equal to itself ... if it is it is equal ... so a je  instruction jumps ... if it is not equal, it does not jump.... 
  188. To crack this program we can change the je instruction into two nop instructions... and we are done...
  189.  
  190.  
  191.  
  192. We have seen here, that the call has put a value in eax.... something which is not equal to zero or a zero... In our 
  193. previous example we saw that the called Is_Serial_Valid call set some value in memory ... Here we see that the called 
  194. Is_Serial_Valid call sets the eax register of our processor to some value....
  195.  
  196. Step 4: Changing the original program...
  197. So modify it :-)
  198. 1. Open Hiew.
  199. 2. Open the file within Hiew.
  200. 3. Find the Adress of the line in W32Dasm (it's on the status bar beginning with '@').
  201. 4. Press F5 in Hiew.
  202. 5. Enter the address you have found in (4) and press ENTER.
  203. 6. Press F3 - for activating the write option.
  204. 7. Press F2 - to change the instruction.
  205. 8. Replace the command by 'NOP' (without quotes), which means NO OPERATION.
  206. 9. Now a new command appeared in the next line.
  207. 10. Replace it by NOP too.
  208. 11. If another new instruction hasn't appeared, Press F9 to update the file.
  209. 12. Press F10 to exit.
  210. 13. Run the program and see the result.
  211.  
  212. If you didn't succeed, have any questions or need any additional information,
  213. E-Mail me at sagid@netvision.net.il and I will answer all of your questions.
  214.  
  215. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  216.  
  217. 
  218. 5. Conclusion
  219. 
  220.  
  221.  
  222. I gave this quite 'hard' cracking example so that u know that if you crack this program,
  223. you can crack almost every program, and most of them are much simpler to crack.
  224. In the next part you will learn to detect key generators and crack them.
  225.  
  226. Before you go to the next chapter, go over the steps again, and also go over the protection
  227. mechanism detection and modification.
  228.  
  229. C ya then.
  230.  
  231.  
  232. ------------------------------------
  233.  
  234. Visit our website for more stuff* at:  blacksun.box.sk
  235. <TeCh~LoRd>
  236.  
  237.  
  238. * Security tutorials, networking tutorials, programming tutorials, IRC-related tutorials, HTML tutorials, encryption tutorials, cracking tutorials, phreaking tutorials and more!!